package com.macro.mall.tiny.modules.pms.service.impl;

import cn.hutool.core.util.ObjUtil;
import com.macro.mall.tiny.modules.pms.model.PmsErrorCode;
import com.macro.mall.tiny.modules.pms.mapper.PmsErrorCodeMapper;
import com.macro.mall.tiny.modules.pms.service.PmsErrorCodeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author tyrone
 * @since 2024-10-09
 */
@Service
public class PmsErrorCodeServiceImpl extends ServiceImpl<PmsErrorCodeMapper, PmsErrorCode> implements PmsErrorCodeService {

    @Autowired
    private PmsErrorCodeMapper pmsErrorCodeMapper;

    @Override
    public List<Map<String, Object>> getErrorCodeCategoryByBrandId(Integer brandId) {
        List<Map<String, Object>> result =  pmsErrorCodeMapper.getErrorCodeCategoryByBrandId(brandId);
        if (ObjectUtils.isEmpty(result)) {
            return Collections.emptyList();
        }
        return result;
    }
}
